package com.zqxq.lottery.mapper.order;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.lottery.entity.po.order.FollowOrderPO;
import com.zqxq.lottery.entity.po.order.UserOrderPO;
import com.zqxq.lottery.entity.vo.expert.ExpertDetailVO;
import com.zqxq.lottery.entity.vo.order.FollowOrderVO;
import com.zqxq.lottery.entity.vo.order.PushOrderDetailVO;
import com.zqxq.lottery.entity.vo.order.PushOrderVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component(value = "followOrderMapper")
public interface FollowOrderMapper extends BaseMapper<FollowOrderPO> {

    List<FollowOrderVO> selectFollowOrderList(@Param("userId") String userId, @Param("orderId") String orderId, @Param("type") Integer type, Page<FollowOrderVO> page);

    List<FollowOrderVO> queryFunsCount(@Param("followUserId") String followUserId, Page<FollowOrderVO> page);

    List<String> getPrizeCount(@Param("userId") String userId);

    List<String> getLastSevenPrizeStatus(@Param("userId") String userId);

    List<PushOrderDetailVO> getPushOrderList(@Param("userId") String userId, @Param("type") Integer type, @Param("status") Integer status, Page<PushOrderDetailVO> page);

    PushOrderVO getPushOrderCount(@Param("userId") String userId,@Param("type") Integer type);

    ExpertDetailVO getExpertInfo(@Param("userId") String userId,@Param("followUserId") String followUserId);

    List<PushOrderDetailVO> getfollowOrderListByExpertId(@Param("userId") String userId);

    PushOrderDetailVO getPushOrderDetailByPid(@Param("orderId") String orderId);

    ExpertDetailVO getProfitOddsByUserId(@Param("followStatus") Integer followStatus,@Param("expertId") String expertId);

    String getLastStatusByUserId(@Param("expertId") String expertId);

    String getLast30DayStatusByUserId(@Param("expertId") String expertId);

    @Select("select count(*) from user_order where ticket_status=1 and follow_status=2 and user_id=#{user_id} and date(create_time)=CURDATE()")
    Integer selectFollowCount(String user_id);

    List<UserOrderPO> getRobotPushOrder();

    @Select("select count(id) from user_order where user_id in(select user_id from expert_info where type=1 and robot_status=1) and follow_status=2 and ticket_status=1 and date(create_time)=CURDATE()")
    Integer getPushOrdersToday();

    PushOrderDetailVO getFinishOrderById(String orderId);
}
